<template>
  <div class="app-container">

    <el-table
      :key="tableKey"
      v-loading="listLoading"
      :data="list"
      border
      fit
      highlight-current-row
      style="width: 100%;"
    >
      <el-table-column label="序号" align="center" width="80" type="index" />
      <el-table-column label="今日在线站长" align="center" min-width="120">
        <template slot-scope="{row}">
          <span>{{ row.qudao }}</span>
        </template>
      </el-table-column>
      <!-- <el-table-column label="所归属代理" min-width="120" align="center">
        <template slot-scope="{row}">
          <span>{{ row.daili }}</span>
        </template>
      </el-table-column> -->
      <el-table-column label="今日启动UV" min-width="120" align="center">
        <template slot-scope="{row}">
          <span>{{ row.uv }}</span>
        </template>
      </el-table-column>
    </el-table>

    <pagination v-show="total > listQuery.limit" :total="total" class="pageShow" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
    <pagination v-show="total > listQuery.limit" layout="prev, pager, next" :small="true" class="pageHidden" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
  </div>
</template>

<script>
import { fetchList } from '@/api/cnzz/online'
import waves from '@/directive/waves' // waves directive
import Pagination from '@/components/Pagination' // secondary package based on el-pagination

export default {
  name: 'Online1',
  components: { Pagination },
  directives: { waves },
  data() {
    return {
      tableKey: 0,
      list: null,
      total: 0,
      listLoading: true,
      listQuery: {
        page: 1,
        limit: 20
      }
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList() {
      this.listLoading = true
      fetchList(this.listQuery).then(response => {
        this.list = response.data
        this.total = response.total
        this.listLoading = false
      })
    }
  }
}
</script>

<style scoped>
  .pageHidden{
    display: none;
  }
  @media (max-width:550px) {
    .pageShow {
      display: none;
    }
    .pageHidden {
      display: block;
    }
    .pickertime{
      width: 100%;
    }
  }
</style>
